package dao;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import entity.Endereco;
import idao.IEnderecoDAO;

public class EnderecoDAO implements IEnderecoDAO{

	private Session session;
	
	@Override
	public void cadastra(Endereco endereco) {
		
		session = ConexaoBanco.getInstance();
		
		Transaction tx = session.beginTransaction();
		session.save(endereco);
		tx.commit();
		session.close();
	}

	@Override
	public void atualiza(Endereco endereco) {
		
		session = ConexaoBanco.getInstance();
		
		Transaction tx = session.beginTransaction();
		session.update(endereco);
		tx.commit();
		session.close();
		
	}
}
